package com.smart.autohome.bean;

import java.util.List;

import com.geccocrawler.gecco.GeccoEngine;
import com.geccocrawler.gecco.annotation.Gecco;
import com.geccocrawler.gecco.annotation.HtmlField;
import com.geccocrawler.gecco.annotation.Request;
import com.geccocrawler.gecco.request.HttpGetRequest;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.spider.HtmlBean;

/**
 * 汽车之家原创文章分页链接
 * http://www.autohome.com.cn/all/#pvareaid=2023310
 * @author lidapeng
 *
 */
@Gecco(matchUrl = "http://www.autohome.com.cn/all", pipelines = { "consolePipeline",
		"mongoPipeline"})
public class ArticleList implements HtmlBean{

	private static final long serialVersionUID = 63001329158980477L;

	
	@Request
	private HttpRequest request;
	//#auto-channel-lazyload-article > ul:nth-child(1)
	//#auto-channel-lazyload-article > ul:nth-child(2)
	//#auto-channel-lazyload-article > ul:nth-child(1) > li:nth-child(1)
	//#auto-channel-lazyload-article > ul:nth-child(1) > li:nth-child(2)
	//#auto-channel-lazyload-article > ul:nth-child(1) > li:nth-child(1) > a > div.article-pic
	//#auto-channel-lazyload-article > ul:nth-child(1) > li:nth-child(1) > a > h3
	@HtmlField(cssPath = "#auto-channel-lazyload-article > ul > li")
	private List<ArticleDetail> detailList;
	
	
	public List<ArticleDetail> getDetailList() {
		return detailList;
	}
	public void setDetailList(List<ArticleDetail> detailList) {
		this.detailList = detailList;
	}
	
	
	public HttpRequest getRequest() {
		return request;
	}
	public void setRequest(HttpRequest request) {
		this.request = request;
	}
	
	
	public static void main(String[] args) {
	

		HttpGetRequest start = new HttpGetRequest("http://www.autohome.com.cn/all");
		start.addCookie("fvlid", "1487562669666fYtfEZM4; sessionip=27.191.138.13; sessionid=D828E8EA-F93E-4825-9B6D-E6A294736F36%7C%7C2017-02-20+11%3A51%3A10.655%7C%7C0; __utma=1.1455104925.1487562671.1487562671.1487565305.2; __utmb=1.0.10.1487565305; __utmc=1; __utmz=1.1487562671.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); ref=0%7C0%7C2023310%7C0%7C2017-02-20+12%3A39%3A05.711%7C2017-02-20+11%3A51%3A10.655; sessionvid=BB1B3B84-3A0F-417F-A62F-4A0ACE8B27AB; area=130299; ahpvno=6");
		start.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
		start.addHeader("Accept-Encoding", "gzip, deflate, sdch");
		start.addHeader("Accept-Language", "zh-CN,zh;q=0.8");
		start.addHeader("Cache-Control", "max-age=0");
		start.addHeader("Connection", "keep-alive");
		start.addHeader("Host", "www.autohome.com.cn");
		start.addHeader("If-Modified-Since", "Mon, 20 Feb 2017 03:38:56 GMT");
		start.addHeader("If-None-Match", "0c82dd2a8bd21:0");
		start.addHeader("Upgrade-Insecure-Requests", "1");
		start.addHeader("User-Agent", "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36");
		start.setCharset("GBK");
		GeccoEngine.create().classpath("com.smart.autohome1").interval(2000).start(start).run();
	}
	
	
	
	
	
}
